﻿@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@using ECG.WebUI.Models
@model ECG.Common.ProductRateByCateTopListPagingDto

@{
    var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = Model.Id, productName = StringUtil.RemoveSpecialCharactersVn(Model.Name) });
}
@if (Model.CreateDate.Date >= DateTime.Now.Date)
{
    <input type="hidden" value="@Model.CreateDate.ToString("yyyy-MM-dd") 00:00:00" class="timedown" />
}
<div class="p-d-clock">

    @* @Model.CreateDate.ToString("yyyy-MM-dd hh:mm")<input type="hidden" value="2014-3-13 20:00" class="timedown" />*@
    @*<span>19:12:09</span>*@
    @*<span>1</span>
        <span>9</span>
        :
        <span>0</span>
        <span>6</span>
        :
        <span>4</span>
        <span>2</span>*@
</div>
<div class="p-d-body">
    <div class="p-d-img">
        @if (Model.PromotionPrice > 0)
        {
            <span class="p-d-promo">-@Model.DiscountPercentage.ToString("#,#")%</span>
        }
        <a href="@pDetailLink">
            <img src="@Model.ImagePath.ImagePathThumb(125, 125)" width="125" height="125" alt="@Model.Name" />
        </a>
    </div>
    <div class="p-d-name">
        <div style="line-height: 13px; margin-top: 5px;text-align: left; bottom: 15px; position: absolute;">
            @{
                string StarPercent = "0";
                if (Model.AverageRate > 0)
                {
                    StarPercent = (Convert.ToDouble(Model.AverageRate) * 100 / 5).ToString("#.#").Replace(',', '.');
                }
            }
            <span class="itm-ratStars inlineBlocka"><span style="width: @StarPercent%;" class="itm-ratStars itm-ratRating"></span></span>
        </div>
        <a href="@pDetailLink" title="@Model.Name">@Model.Name</a>
    </div>
    @if (Model.PromotionPrice > 0)
    {
        <div class="p-d-price-root">
            @Model.Price.ToString("##,###,###") đ
        </div>
        <div class="p-d-price-curent">
            <span class="price-red">
                @Model.PromotionPrice.ToString("##,###,###") đ
            </span>
        </div>
    }
    else
    {
        <div class="p-d-price-curent">
            <span class="price-red">
                @Model.Price.ToString("##,###,###") đ
            </span>
        </div>
    }
</div>
